Getting Started with Analying Unique Sounds of San Francisco


In [1]:
import pandas as pd

from pylab import plot, show, title, xlabel, ylabel, subplot, savefig

import matplotlib.pyplot as plt
%matplotlib inline

In [2]:
df = pd.read_csv('datasets/foghorn.csv')
df.head()


Out[2]:
wave_value
0 0
1 0
2 0
3 1
4 1

In [3]:
fig,(ax) = plt.subplots(figsize=(24,12), ncols=1)
#data = [0,1,2,3,4]

ax.plot(df['wave_value'])
fig.tight_layout()
fig.show()


C:\Users\tgreen\AppData\Local\Continuum\Anaconda2\lib\site-packages\matplotlib\figure.py:397: UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure
  "matplotlib is currently using a non-GUI backend, "

In [4]:
df.count()


Out[4]:
wave_value    3816832
dtype: int64

In [5]:
import pandas as pd
import numpy as np

import wave

import scipy.io.wavfile
import math

from pylab import plot, show, title, xlabel, ylabel, subplot, savefig
from scipy import fft, arange, ifft
from numpy import sin, linspace, pi
from scipy.io.wavfile import read,write

%matplotlib inline

import warnings
warnings.filterwarnings('ignore')

import seaborn as sns

## MASTERING MARKDOWN 
## https://guides.github.com/features/mastering-markdown/

## IMAGE RESIZER
## http://auctionrepair.com/pixels.html

import matplotlib.pyplot as plt

In [7]:
#colors = ('b', 'g', 'r', 'c', 'm', 'y', 'k')
fig,(ax) = plt.subplots(figsize=(24,12), ncols=1)

y=df['wave_value']
lungime=len(y)
timp=len(y)/44100.
t=linspace(0,timp,len(y))

plt.xlabel('Time in Seconds', fontsize = 20)
plt.ylabel('Wave Length', fontsize = 20)
plt.tick_params(axis='both', which='major', labelsize=20)

plt.title("Fog Horn",y=1.02, fontsize = 24)

ax.plot(t,y)
fig.tight_layout()
fig.show()
fig.savefig('fog_horn.png')



In [ ]: